package Demo7;

public class DemoMain {
    public static void main(String[] args) {
        Computer computer = new Computer();
        computer.powerOn();
        Mouse mouse = new Mouse(); // 鼠标
        // 参数是USB类型，我正好传递进去的就是USB鼠标
        USB usbMouse = new Mouse();  // 向上转型
        computer.useDevice(usbMouse);

        // 创建一个USB键盘
        Keyboard keyboard = new Keyboard();
        // 方法参数是USB类型，传递进去的是实现类对象

        computer.useDevice(keyboard);  // 向上转型
//        computer.useDevice(new Keyboard());
        computer.powerOff();
        System.out.println("==============");
        method(10.0);
        method(10);
        int a = 30;
        method(a);
    }

    public static void method(double num) {
        System.out.println(num);
    }
}
